package com.example.demo99.Controller;

import com.example.demo99.Entity.AccountRecord;
import com.example.demo99.Service.AccountRecordService;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/account")
public class AccountRecordController {
    private AccountRecordService accountRecordService;


    @PostMapping("/add")
    public AccountRecord addRecord(@RequestBody AccountRecord record) {
        return accountRecordService.save(record);
    }

    @GetMapping("/all")
    public List<AccountRecord> getAll() {
        return accountRecordService.getAllRecords();
    }
}
